{% import "TopxiaWebBundle::macro.html.twig" as web_macro %}
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1">
    <meta name="renderer" content="webkit">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=no" name="format-detection" />
    <meta content="{{ csrf_token('site') }}" name="csrf-token" />

    {% include 'TopxiaWebBundle:Player:stylesheet.html.twig' %}
  </head>
  <body style="overflow:hidden;border:0px;">
    {% if file|default(null) %}
      {% if file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus == 'error' %}
        <div class="alert alert-danger">{{'转码失败，请联系管理员。'|trans}}</div>
      {% elseif file.storage == 'cloud' and file.type in ['ppt', 'document','video'] and file.convertStatus != 'success' %}
        <div class="alert alert-danger">{{'正在转码，请稍后尝试。'|trans}}</div>
      {% else %}
        <div style="position:absolute;top:0;bottom:0;left:0;right:0;text-align:center;">
          <div id="lesson-video-content"
          data-user-id="{{app.user.id|default(0)}}"
          data-user-name="{{app.user.username|default('')}}"
          data-file-global-id="{{file.globalId}}"
          data-file-id="{{file.id}}"
          data-file-type="{{file.type}}"
          data-url="{{url}}"
          {% if context.hideBeginning|default(0) == 0 %}
            data-video-header-length="{{ context.videoHeaderLength|default(0) }}"
          {% endif %}
          data-enable-playback-rates="{{ setting('storage.enable_playback_rates')|default(false) }}"
          data-player="{{player}}"
          data-agentInWhiteList="{{agentInWhiteList}}"
          {% if not file.convertParams.hasVideoWatermark|default(0) and setting('storage.video_watermark') > 0 and setting('storage.video_watermark_image') %}
            data-watermark="{{ fileurl(setting('storage.video_watermark_image'), null) }}"
          {% endif %}
          {% if setting('storage.cloud_access_key') %}
            data-access-key="{{ setting('storage.cloud_access_key') }}"
          {% endif %}
          {% if setting('storage.video_fingerprint') and app.user %}
            data-fingerprint="{{ finger_print() }}"
            data-fingerprint-src="{{ url('cloud_video_fingerprint', {userId:app.user.id}) }}"
            data-fingerprint-time="{{ setting('storage.video_fingerprint_time')|default(0.5) * 1000 }}"
          {% endif %}
          {% if player == 'balloon-cloud-video-player' %}
            class="ballon-video-player"
          {% else %}
            class="{{ player }}"
          {% endif %}
          {% if context.hideQuestion|default(0) == 0 %}
            data-markerurl="{{ path('course_lesson_question_markers_show', {mediaId: file.id}) }}"
          {% endif %}
          {% if context.subtitles is defined and context.hideSubtitle|default(0) == 0%}
            data-subtitles="{{ context.subtitles|json_encode }}"
          {% endif %}
            data-timelimit="{{ context.watchTimeLimit|default('')}}"
            data-starttime="{{ context.starttime|default('')}}"
            data-lesson-id="{{ context.lessonId|default(0)}}"
            style="height:100%"
          ></div>
        </div>

        {% set script_controller = 'player/show' %}

        {% include 'TopxiaWebBundle::script_boot.html.twig' with {script_main: asset('bundles/topxiaweb/js/app.js')} %}
      {% endif %}
    {% else %}
      <div class=""><br>&nbsp;&nbsp;&nbsp;&nbsp;{{'该浏览器不支持云视频播放，请前往'|trans}}<a href="{{path('mobile')}}" target="parent">{{'下载App'|trans}}</a>。</div>
    {% endif %}
  </body>
</html>
